package org.example.freeswitchdemo.controller;


import org.freeswitch.esl.client.inbound.Client;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CallController {

    private final Client eslClient;

    public CallController(Client eslClient) {
        this.eslClient = eslClient;
    }

    @GetMapping("/call")
    public String makeCall() {
        String command = "originate user/1000 &bridge(user/1001)";
        eslClient.sendSyncApiCommand("bgapi", command);
        return "✅ 已经发起呼叫: " + command;
    }
}

